import React from 'react'
import { useEffect } from 'react'
import { useState } from 'react'

export default function App() {
  const [count, setCount] = useState(1)
  const [ishot, setIshot] = useState(true)

  useEffect (()=>{
    console.log('天气变了');
  },[ishot])
  useEffect(()=>{
    console.log('数字变了');
  },[count])


  
  return (
    <div>
      <h1>今天天气真{ishot?'热':'冷'}</h1>
      <button onClick={()=>{setIshot(!ishot)}}>天气变化</button>
      <br />
      <h1>{count}</h1>
      <button onClick={()=>{setCount(count + 1)}}>累加器</button>
      </div>
  )
}
